package com.ruoyi.inspection.controller;

import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.constant.GlobalConstants;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.inspection.config.GovernDataConfig;
import com.ruoyi.inspection.config.GovernTaskConfig;
import com.ruoyi.inspection.constant.InspectionConstant;
import com.ruoyi.inspection.domain.GovernCheckTaskInfo;
import com.ruoyi.inspection.domain.GovernCheckTaskPlan;
import com.ruoyi.inspection.domain.GovernHiddenInventory;
import com.ruoyi.inspection.mapper.GovernHiddenInventoryMapper;
import com.ruoyi.inspection.service.GovernCheckTaskInfoService;
import com.ruoyi.system.domain.SysDanger;
import com.ruoyi.system.entity.*;
import com.ruoyi.system.mapper.*;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.*;

/**
 * @author He Bo
 * @create 2024/7/10 17:33
 */
@Slf4j
@RestController
@RequestMapping("/pushGovernInspectionTask")
@Component
public class GovernInspectionTaskPush {
    @Resource
    private GovernHiddenInventoryMapper governHiddenInventoryMapper;
    @Resource
    private GovernCheckTaskInfoService governCheckTaskInfoService;
    @Resource
    private PreventionDeviceMapper preventionDeviceMapper;
    @Resource
    private SysDangerMapper sysDangerMapper;
    @Resource
    private PushInfoMapper pushInfoMapper;

    /**
     * 推送专项检查下的隐患信息
     *
     * @param governHiddenInventory
     * @return
     */
    public boolean pushSpecialCheckInvestigation(GovernHiddenInventory governHiddenInventory)
    {
        // 查出隐患对应的危险源
        PreventionDevice preventionDevice = preventionDeviceMapper.queryById(governHiddenInventory.getDeviceId());
        SysDanger sysDanger = sysDangerMapper.queryByName(preventionDevice.getDangerName());
        governHiddenInventory.setDangerCode(sysDanger.getDangerCode());

        // 上传隐患
        pushInvestigation(governHiddenInventory);
        // 上报专项检查
        pushInvestigationAboutSpecialCheck(governHiddenInventory);
        return true;
    }

    /**
     * 推送隐患信息
     *
     * @return
     */
    public boolean pushInvestigation(GovernHiddenInventory governHiddenInventory) {
        // 封装推送数据
        List<JSONObject> pushData = new ArrayList<>();
        pushData.add( pojoToJson(governHiddenInventory) );
        // 执行推送
        return execPush(pushData);
    }

    /**
     * 推送隐患信息ej7ji
     *
     * @return
     */
    public boolean pushInvestigationList() {
        // 查出所有隐患
        GovernHiddenInventory governHiddenInventory = new GovernHiddenInventory();
        governHiddenInventory.setGovernUpload(0);
        governHiddenInventory.setGovernConfirm(1);
        List<GovernHiddenInventory> list = governHiddenInventoryMapper.queryAllByLimit(governHiddenInventory);
        // 封装推送数据
        List<JSONObject> pushData = pojoToJsonList(list);
        // 执行推送
        return execPush(pushData);
    }

    public List<JSONObject> pojoToJsonList(List<GovernHiddenInventory> list) {
        if (StringUtils.isEmpty(list)) {
            return null;
        }
        List<JSONObject> data = new ArrayList<>();
        for (GovernHiddenInventory governHiddenInventory : list) {
            // 查出隐患对应的危险源
            PreventionDevice preventionDevice = preventionDeviceMapper.queryById(governHiddenInventory.getDeviceId());
            SysDanger sysDanger = sysDangerMapper.queryByName(preventionDevice.getDangerName());
            governHiddenInventory.setDangerCode(sysDanger.getDangerCode());

            data.add(pojoToJson(governHiddenInventory));
        }
        return data;
    }

    /**
     * 封装危险源
     * @param governHiddenInventory
     * @return
     */
    public JSONObject pojoToJson(GovernHiddenInventory governHiddenInventory) {
        net.sf.json.JSONObject obj = new net.sf.json.JSONObject();
        String governId = governHiddenInventory.getGovernId();
        governId = StringUtils.isEmpty(governId) ? UUID.randomUUID().toString() : governId;
        GovernHiddenInventory entity = new GovernHiddenInventory();
        entity.setHiddenInventoryId(governHiddenInventory.getHiddenInventoryId());
        entity.setGovernId(governId);
        governHiddenInventoryMapper.update(entity);
        governHiddenInventory.setGovernId(governId);

        obj.put("id", governId);
        obj.put("companyCode", GlobalConstants.COMPANY_CODE);
        obj.put("hazardCode", governHiddenInventory.getDangerCode());   // 危险源编码
        obj.put("riskMeasureId", "");
        obj.put("checkRecordId", "");
        obj.put("dangerName", governHiddenInventory.getHiddenInventoryName());
        obj.put("dangerLevel", GovernDataConfig.YIN_HUAN_DENG_JI.get(governHiddenInventory.getHiddenLevel()).toString());
        obj.put("dangerSrc", GovernDataConfig.YIN_HUAN_LAI_YUAN.get(governHiddenInventory.getHiddenSource()));
        obj.put("dangerManageType", GovernDataConfig.ZHI_LI_LEI_XING.get(governHiddenInventory.getDangerManageType()));
        obj.put("dangerDesc", governHiddenInventory.getHiddenInfo());
        obj.put("dangerReason", governHiddenInventory.getHiddenEntryBasis());
        obj.put("controlMeasures", governHiddenInventory.getHiddenRectificationMeasures());
        obj.put("cost", governHiddenInventory.getHiddenManagingFunds());
        obj.put("dangerManageDeadline", governHiddenInventory.getRectificationEndTime());
        obj.put("dangerState", GovernDataConfig.YIN_HUAN_ZHUANG_TAI.get(governHiddenInventory.getHiddenProgress()));
        obj.put("hazardDangerType", GovernDataConfig.YIN_HUAN_LEI_XING.get(governHiddenInventory.getHiddenType()));
        obj.put("hazardCategory", GovernDataConfig.YIN_HUAN_LEI_BIE.get(governHiddenInventory.getHiddenBelongType()));
        obj.put("registrant", governHiddenInventory.getRegisterUserName());
        obj.put("registTime", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", governHiddenInventory.getHiddenCheckTime()));
        obj.put("liablePerson", governHiddenInventory.getRectificationUserName());
        obj.put("checkAcceptPerson", governHiddenInventory.getReviewUserName());
        obj.put("checkAcceptComment", governHiddenInventory.getHiddenReviewInfo());
        obj.put("checkAcceptTime", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", governHiddenInventory.getHiddenReviewTime()));
        obj.put("createDate", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", governHiddenInventory.getGovernCreateDate()));
        obj.put("createBy", governHiddenInventory.getGovernCreateBy());
        obj.put("updateDate", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", governHiddenInventory.getGovernUpdateDate()));
        obj.put("updateBy", governHiddenInventory.getGovernUpdateBy());
        obj.put("deleted", governHiddenInventory.getGovernDeleted()+"");
        return obj;
    }

    public boolean execPush(List<JSONObject> data) {
        String url = GovernTaskConfig.investigation;
        String s = GovernTaskConfig.pushData(JSONUtil.toJsonPrettyStr(data), url);
        pushInfoMapper.insert(s);

        return true;
    }

    /**
     * fgcvbervws-80956793637830656-qqq-00x
     * @param id
     * @return
     */
    public String enId(String id) {
        String a = "fgcvbervws-" + id + "-";
        String a1 = StrUtil.fillAfter(a, 'q', 32);
        return a1;
    }



    /**
     * 上报专项检查隐患信息数据 （接口 4.8）
     * @return
     */
    public boolean pushInvestigationAboutSpecialCheck(GovernHiddenInventory governHiddenInventory) {
        List<net.sf.json.JSONObject> data = new ArrayList<>();
        net.sf.json.JSONObject obj = new net.sf.json.JSONObject();

//        obj.put("id", enId(governHiddenInventory.getHiddenInventoryId().toString()) + "-006");
        String governId2 = governHiddenInventory.getGovernId2();
        governId2 = StringUtils.isEmpty(governId2) ? UUID.randomUUID().toString() : governId2;
        GovernHiddenInventory entity = new GovernHiddenInventory();
        entity.setHiddenInventoryId(governHiddenInventory.getHiddenInventoryId());
        entity.setGovernId2(governId2);
        governHiddenInventoryMapper.update(entity);
        governHiddenInventory.setGovernId2(governId2);
        obj.put("id", governId2);

        obj.put("companyCode", GlobalConstants.COMPANY_CODE);

//        obj.put("dangerId", enId(governHiddenInventory.getHiddenInventoryId().toString()) + "-005");
        obj.put("dangerId", governHiddenInventory.getGovernId());

        obj.put("taskId", governHiddenInventory.getGovernCheckTaskId());
        obj.put("checkType", GovernDataConfig.JIAN_CHA_LEI_XING.get(governHiddenInventory.getHiddenCheckType()));
        obj.put("checkItemId", governHiddenInventory.getGovernCheckTaskItemId());
        obj.put("checkScoreId", governHiddenInventory.getGovernCheckTaskItemScoreId());
        obj.put("checkDate", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", governHiddenInventory.getHiddenCheckTime()));
        obj.put("checkPay", governHiddenInventory.getHiddenCheckPay());
        obj.put("harmType", GovernDataConfig.WEI_HAI_LEI_XING.get(governHiddenInventory.getHarmType()));
        obj.put("deleted", governHiddenInventory.getGovernDeleted()+"");
        obj.put("createDate", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", governHiddenInventory.getGovernCreateDate()));
        obj.put("createBy", governHiddenInventory.getGovernCreateBy());
        obj.put("updateDate", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", governHiddenInventory.getGovernUpdateDate()));
        obj.put("updateBy", governHiddenInventory.getGovernUpdateBy());
        data.add(obj);
        String url = GovernTaskConfig.specialInvestigation;
        String s = GovernTaskConfig.pushData(JSONUtil.toJsonPrettyStr(data), url);
        pushInfoMapper.insert(s);

        return true;
    }

    /**
     * 上报专项检查情况记录（接口 4.9）
     * @return
     */
    public boolean pushSpecialCheckRecord(GovernCheckTaskPlan governCheckTaskPlan) {
        GovernCheckTaskInfo taskInfo = governCheckTaskInfoService.queryById(governCheckTaskPlan.getGovernTaskInfoId());

        List<net.sf.json.JSONObject> data = new ArrayList<>();
        net.sf.json.JSONObject obj = new net.sf.json.JSONObject();
        obj.put("id", enId(governCheckTaskPlan.getGovernTaskPlanId().toString()) + "-008");
        obj.put("companyCode", GlobalConstants.COMPANY_CODE);
        obj.put("hazardCode", governCheckTaskPlan.getGovernInvolveDangerCode());
        obj.put("taskId", governCheckTaskPlan.getGovernCheckTaskId());
        obj.put("checkType", GovernDataConfig.JIAN_CHA_LEI_XING.get(governCheckTaskPlan.getGovernCheckTaskTypeName()) );
        obj.put("checkDate", DateUtils.parseDateToStr("yyyy-MM-dd", governCheckTaskPlan.getGovernTaskCompleteTime()));
        obj.put("resultStatus", taskInfo.getGovernCompanyStatus()+"");
        obj.put("deleted", governCheckTaskPlan.getGovernDeleted()+"");
        obj.put("createDate", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", governCheckTaskPlan.getGovernCreateDate()));
        obj.put("createBy", governCheckTaskPlan.getGovernCreateBy());
        obj.put("updateDate", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", governCheckTaskPlan.getGovernUpdateDate()));
        obj.put("updateBy", governCheckTaskPlan.getGovernUpdateBy());

        data.add(obj);
        String url = GovernTaskConfig.specialInvestigationRecord;
        String s = GovernTaskConfig.pushData(JSONUtil.toJsonPrettyStr(data), url);
        pushInfoMapper.insert(s);

        return true;
    }





//    /**
//     * 定时任务推送隐患信息
//     *
//     * @return
//     */
//    public AjaxResult pushHiddenInventoryTask() {
//        PreventionHiddenRegister query = new PreventionHiddenRegister();
//        query.setStartTime(getBeginOfDay());
//        query.setEndTime(getEndOfDay());
//        List<PreventionHiddenRegister> preventionHiddenRegisters = preventionHiddenRegisterMapper.queryAllByLimit(query);
//        for (PreventionHiddenRegister preventionHiddenRegister : preventionHiddenRegisters) {
//            Integer deviceId = preventionHiddenRegister.getDeviceId();
//            PreventionDevice preventionDevice = preventionDeviceMapper.queryById(deviceId);
//            SysDanger sysDanger = sysDangerMapper.queryByName(preventionDevice.getDangerName());
//            preventionHiddenRegister.setDangerCode(sysDanger.getDangerCode());
//            PreventionHiddenInfoRecord preventionHiddenInfoRecord = preventionHiddenInfoRecordMapper.queryHiddenId(preventionHiddenRegister.getId());
//            if (null == preventionHiddenInfoRecord || preventionHiddenInfoRecord.getType() != 1) {
//                continue;
//            }
//            Integer preventionCheckTaskConfigId = preventionHiddenInfoRecord.getPreventionCheckTaskConfigId();
//            PreventionCheckTaskConfig preventionCheckTaskConfig = preventionCheckTaskConfigMapper.queryById(preventionCheckTaskConfigId);
//            PreventionSecurityRisk preventionSecurityRisk = preventionSecurityRiskMapper.queryById(preventionCheckTaskConfig.getSecurityRiskId());
//            preventionHiddenRegister.setPreventionHiddenInfoRecord(preventionHiddenInfoRecord);
//            preventionHiddenRegister.setSecurityRiskId(preventionSecurityRisk.getId());
//        }
//        List<net.sf.json.JSONObject> data = new ArrayList<>();
//        for (PreventionHiddenRegister preventionHiddenRegister : preventionHiddenRegisters) {
//            String state = checkStateCase(preventionHiddenRegister.getHiddenProgress());
//            if (StrUtil.isEmpty(state)) {
//                continue;
//            }
//            net.sf.json.JSONObject obj = new net.sf.json.JSONObject();
//            obj.put("id", enId(preventionHiddenRegister.getId().toString()) + "-005");
//            obj.put("companyCode", "310170003");
//            obj.put("hazardCode", preventionHiddenRegister.getDangerCode());
//            if (null != preventionHiddenRegister.getSecurityRiskId()) {
//                obj.put("riskMeasureId", enId(preventionHiddenRegister.getSecurityRiskId().toString()) + "-002");
//            }
//            if (null != preventionHiddenRegister.getPreventionHiddenInfoRecord()) {
//                obj.put("checkRecordId", enId(preventionHiddenRegister.getPreventionHiddenInfoRecord().getPreventionCheckTaskId() + "004"));
//            }
//            obj.put("dangerName", preventionHiddenRegister.getHiddenName());
//            obj.put("dangerLevel", checkHiddenLevel(preventionHiddenRegister.getHiddenLevel()));
//            obj.put("dangerSrc", checkSrc(preventionHiddenRegister.getHiddenCheckType()));
//            obj.put("dangerManageType", "1");
//            obj.put("dangerDesc", preventionHiddenRegister.getHiddenInfo());
//            obj.put("dangerReason", preventionHiddenRegister.getHiddenEntryBasis());
//            obj.put("controlMeasures", preventionHiddenRegister.getHiddenRectificationMeasures());
//            obj.put("cost", preventionHiddenRegister.getHiddenManagingFunds());
//            obj.put("dangerManageDeadline", preventionHiddenRegister.getRectificationEndTime());
//            obj.put("dangerState", state);
//            obj.put("hazardDangerType", checkType(preventionHiddenRegister.getHiddenType()));
//            obj.put("registrant", preventionHiddenRegister.getRegisterUserName());
//            obj.put("registTime", preventionHiddenRegister.getHiddenCheckTime());
//            obj.put("liablePerson", preventionHiddenRegister.getRectificationUserName());
//            obj.put("checkAcceptPerson", preventionHiddenRegister.getReviewUserName());
//            obj.put("checkAcceptComment", preventionHiddenRegister.getHiddenReviewInfo());
//            obj.put("checkAcceptTime", preventionHiddenRegister.getHiddenReviewTime());
//            obj.put("deleted", "0");
//            obj.put("createDate", LocalDateTimeUtil.format(preventionHiddenRegister.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
//            obj.put("createBy", preventionHiddenRegister.getRegisterUserName());
//            obj.put("updateDate", LocalDateTimeUtil.format(preventionHiddenRegister.getUpdateTime(), "yyyy-MM-dd HH:mm:ss"));
//            obj.put("updateBy", preventionHiddenRegister.getRegisterUserName());
//            //hazardCategory
//            obj.put("hazardCategory", getWorkType(preventionHiddenRegister.getRegisterUserId().toString()));
//            data.add(obj);
//        }
//        String url = PreventionConfig.investigation;
//        String s = PreventionConfig.pushData(JSONUtil.toJsonPrettyStr(data), url);
//        pushInfoMapper.insert(s);
//        return AjaxResult.success();
//    }



//
//    /**
//     * 推送重大危险源清单
//     * @return
//     */
//    @GetMapping("/pushDangerList")
//    public ResultInfo pushDangerList() {
//        dangerList();
//        return new ResultInfo();
//    }
//
//    /**
//     * 推送实时检测
//     * @return
//     */
//    @GetMapping("/pushDangerPoint")
//    public ResultInfo pushDangerPoint() {
//        dangerPoint();
//        return new ResultInfo();
//    }
//
////    @Scheduled(cron = "0/60 * * * * ?")
//    public void monitorScheduled() {
//        List<Integer> list = sysMonitorMapper.queryAllByStatus("未恢复",null,null);
//        List<Integer> list1 = sysMonitorMapper.queryAllByStatus("已超时",null,null);
//        recovery.addAll(list);
//        recovery.addAll(list1);
//        String now = DateUtil.now();
//        String offset = DateUtil.offset(DateUtil.date(), DateField.MINUTE, -2).toString("yyyy-MM-dd HH:mm:ss");
//        List<Integer> list2 = sysMonitorMapper.queryAllByStatus("已恢复", offset, now);
//        Set<Integer> collect = list2.stream().filter(i -> recovery.contains(i)).collect(Collectors.toSet());
//        if (CollUtil.isNotEmpty(collect)) {
//            recovery.removeAll(collect);
//            monitor(collect);
//        }
//    }
//
//    /**
//     * 报警信息
//     */
//    public void monitor(Set<Integer> ids) {
//        List<JSONObject> list = new ArrayList<>();
//        for (Integer id : ids) {
//            SysMonitor sysMonitor = sysMonitorMapper.queryById(id);
//            JSONObject jsonObject = new JSONObject();
//            jsonObject.set("moduleType", IntegrationConfig.BJXX);
//            jsonObject.set("companyName", "石洞口煤气");
//            jsonObject.set("level", sysMonitor.getMonitorLevel());
//            jsonObject.set("type", sysMonitor.getMonitorType());
//            jsonObject.set("deviceName", sysMonitor.getMonitorName());
//            jsonObject.set("value", sysMonitor.getMonitorValue());
//            jsonObject.set("status", sysMonitor.getMonitorState());
//            jsonObject.set("startTime", sysMonitor.getMonitorStartTime());
//            jsonObject.set("stopTime", sysMonitor.getMonitorEndTime());
//            list.add(jsonObject);
//        }
//        IntegrationConfig.push(IntegrationConfig.BJXX,list);
//    }
//
//
//
////    @Scheduled(cron = "0/60 * * * * ?")
//    public void duty() {
//        List<Integer> sysDuties = sysDutyMapper.queryAllByStatus("未完成");
//        uncompleted.addAll(sysDuties);
//        List<Integer> duty = sysDutyMapper.queryAllByStatus("已完成");
//        Set<Integer> collect = duty.stream().filter(i -> uncompleted.contains(i)).collect(Collectors.toSet());
//        if (CollUtil.isNotEmpty(collect)) {
//            uncompleted.removeAll(collect);
//            duty(collect);
//        }
//    }
//
//    /**
//     *  推送包保
//     * @param ids
//     */
//    public void duty(Set<Integer> ids) {
//        List<JSONObject> list = new ArrayList<>();
//        for (Integer id : ids) {
//            SysDuty sysDuty = sysDutyMapper.queryById(id);
//            SysDutyUser byDutyType = sysDutyUserMapper.getByDutyType(sysDuty.getDutyType());
//            SysUser sysUser = sysUserMapper.selectUserById(byDutyType.getUserId().longValue());
//            SysDanger sysDanger = sysDangerMapper.queryByName(sysDuty.getDangerName());
//            JSONObject jsonObject = new JSONObject();
//            jsonObject.set("moduleType", IntegrationConfig.AQBB);
//            jsonObject.set("companyName", "石洞口煤气");
//            jsonObject.set("dangerSourceName", sysDuty.getDangerName());
//            jsonObject.set("dangerSourceLevel", sysDanger.getDangerLevel());
//            jsonObject.set("personId", byDutyType.getUserId());
//            jsonObject.set("person", byDutyType.getUserName());
//            jsonObject.set("personPhone", sysUser.getPhonenumber());
//            jsonObject.set("type", sysDuty.getDutyType());
//            jsonObject.set("mainCreateTime", sysDuty.getUpdateTime());
//            list.add(jsonObject);
//        }
//        IntegrationConfig.push(IntegrationConfig.AQBB,list);
//    }
//
//    /**
//     * 实时检测
//     */
////    @Scheduled(cron = "0/60 * * * * ?")
//    private void dangerPoint() {
//        List<SysDangerPoint> sysDangerPoints = this.sysDangerPointMapper.queryAllByLimit(new SysDangerPoint());
//        List<JSONObject> list = new ArrayList<>();
//        String now = DateUtil.now();
//        JSONObject map = GrottoConfig.getTimeDate();
//        if (ObjectUtil.isNotEmpty(map)) {
//            sysDangerPoints.forEach(sysDangerPoint -> {
//                if (map.containsKey(sysDangerPoint.getBitNumber())) {
//                    Object o = map.get(sysDangerPoint.getBitNumber());
//                    JSONObject jsonObject = new JSONObject();
//                    jsonObject.set("moduleType",IntegrationConfig.SSJC);
//                    jsonObject.set("companyName","石洞口煤气");
//                    jsonObject.set("deviceName",sysDangerPoint.getDeviceName());
//                    jsonObject.set("parameter",sysDangerPoint.getParam());
//                    jsonObject.set("realTimeValue",o.toString());
//                    jsonObject.set("unit",sysDangerPoint.getUnit());
//                    jsonObject.set("rangeUp", StrUtil.isEmpty(sysDangerPoint.getDangerRange()) ? null : sysDangerPoint.getDangerRange().split(",")[1]);
//                    jsonObject.set("rangeDown",StrUtil.isEmpty(sysDangerPoint.getDangerRange()) ? null : sysDangerPoint.getDangerRange().split(",")[0]);
//                    jsonObject.set("lowLowThreshold",sysDangerPoint.getPlayItLow());
//                    jsonObject.set("lowThreshold",sysDangerPoint.getLowQuota());
//                    jsonObject.set("highHighThreshold",sysDangerPoint.getHighAndMighty());
//                    jsonObject.set("highThreshold",sysDangerPoint.getHighQuota());
//                    jsonObject.set("reportTime",now);
//                    list.add(jsonObject);
//                }
//            });
//            IntegrationConfig.push(IntegrationConfig.SSJC,list);
//        }
//    }
//
//    /**
//     * 重大危险源清单
//     */
////    @Scheduled(cron = "0/60 * * * * ?")
//    private void dangerList() {
//        List<SysDanger> dangers = sysDangerMapper.listByLevel();
//        List<JSONObject> list = new ArrayList<>();
//        for (SysDanger danger : dangers) {
//            JSONObject jsonObject = new JSONObject();
//            jsonObject.set("moduleType", IntegrationConfig.ZDWXQD);
//            jsonObject.set("companyName", "石洞口煤气");
//            jsonObject.set("sourcesName", danger.getDangerName());
//            jsonObject.set("code", danger.getDangerCode());
//            jsonObject.set("material", danger.getMaterialName());
//            jsonObject.set("capacity", danger.getMaxStorage());
//            jsonObject.set("target", danger.getQuota());
//            jsonObject.set("sourcesLevel", danger.getDangerLevel());
//            jsonObject.set("notes", danger.getRemarksInfo());
//            list.add(jsonObject);
//        }
//        IntegrationConfig.push(IntegrationConfig.ZDWXQD,list);
//    }
}
